var express = require("express")
var router = express.Router()
var QcloudSms = require("qcloudsms_js")
var connection = require("../../../db/sql")
var jwt = require("jsonwebtoken")
const bcrypt = require("bcryptjs")
var searchSql = require("./searchSql")

/* GET home page. */
router.get("/", function (req, res, next) {
  res.render("index", { title: "Express" })
})

router.post("/api/search/searchshop", function (req, res, next) {
  console.log(req.body)
  connection.query(searchSql.selectShop(req.body), function (err, resluts) {
    if (err) {
      res.send({
        status: 201,
        msg: "搜索出错",
      })
    }

    res.send({
      status: 200,
      msg: "搜索成功",
      data: resluts,
    })
  })
})

module.exports = router
